<%@ page import="util.PageInfo" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="entity.BanJi813" %><%--
  Created by IntelliJ IDEA.
  User: wang'ze'liang
  Date: 2021/8/13
  Time: 14:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/static/bootstrap-3.4.1-dist/css/bootstrap.css"/>
</head>
<body>

    <table class="table table-striped table-bordered table-hover table-condensed">
        <tr>
            <td>ID</td>
            <td>名字</td>
            <td>地址</td>
            <td>删除/修改</td>
        </tr>
        <%
            PageInfo pageInfo = (PageInfo) request.getAttribute("pageInfo");
            ArrayList<BanJi813> list = pageInfo.getList();
            for (BanJi813 banJi813 : list){
        %>
        <tr>
            <td><%=banJi813.getId()%></td>
            <td><%=banJi813.getName()%></td>
            <td><%=banJi813.getAddress()%></td>
            <td>
            </td>
        </tr>
        <%
            }
        %>
    </table>
    <a class="btn btn-primary" href="<%=request.getContextPath()%>/banJi813_insert.jsp">添加</a>
    <nav aria-label="Page navigation">
        <ul class="pagination">
            <%
                if (pageInfo.getPageNo() > 1) {
            %>
            <li>
                <a href="<%=request.getContextPath()%>/banJi813?method=selectByPage&pageNo=<%=pageInfo.getPageNo()-1%>" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <%
            } else {
            %>
            <li class="disabled">
                <a  aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <%
                }
            %>
            <%
                for(int i = 1; i <= pageInfo.getTotalPage(); i++) {
            %>
            <li><a href="<%=request.getContextPath()%>/banJi813?method=selectByPage&pageNo=<%=i%>"><%=i%></a></li>
            <%
                }
                if (pageInfo.getPageNo() < pageInfo.getTotalPage()){
            %>
            <li>
                <a href="<%=request.getContextPath()%>/banJi813?method=selectByPage&pageNo=<%=pageInfo.getPageNo()+1%>" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
            <%
            } else {
            %>
            <li class="disabled">
                <a  aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
            <%
                }
            %>
        </ul>
    </nav>
</body>
</html>
